<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('住院病人列表')" />
	<th:block th:include="include :: layout-latest-css" />
</head>
<body class="gray-bg">
	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<form id="user-form">
						<div class="select-list">
							<ul>
								<li>
									住院号：<input type="text" name="patientId" id="patientId"/>
								</li>
								<li>
									姓名：<input type="text" name="name"/>
								</li>
								<li>
									身份证号：<input type="text" name="idNumber" width="20"/>
								</li>
								<li>
									<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>
				
		        <div class="btn-group-sm" id="toolbar" role="group">
		             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" >
			            <i class="fa fa-edit"></i> 修改
			        </a>
					<a class="btn btn-warning" onclick="$.table.exportExcel()">
						<i class="fa fa-download"></i> 导出
					</a>
		        </div>
		        
		        <div class="col-sm-12 select-table table-striped">
				    <table id="bootstrap-table"></table>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<script th:inline="javascript">
		var prefix = ctx + "pub/pca";

		$(function() {
		    queryPatientList();
		});

		function queryPatientList() {
		    var options = {
		        url: prefix + "/list",
		        // createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        // removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        // importUrl: prefix + "/importData",
		        // importTemplateUrl: prefix + "/importTemplate",
		        // sortName: "createTime",
		        // sortOrder: "desc",
		        modalName: "病人建档信息",
				firstLoad: false,
				clickToSelect: true,
				singleSelect: true,
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'patientId',
		            title: '病人ID'
		        },
		        {
		            field: 'name',
		            title: '姓名',
		        },
		        {
		            field: 'sexCode',
		            title: '性别',
					formatter: function (value, row, index) {
						switch (value) {
							case '1':
								value = '男';
								break;
							case '2':
								value = '女';
								break;
							case '3':
								value = '未知';
								break;
						}
						return value;
					}
		        },
		        {
		            field: 'dateOfBirth',
		            title: '生日'
		        },
		        {
		            field: 'idNumber',
		            title: '身份证',
		        },
		        {
		            field: 'phoneNumber',
		            title: '手机'
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.patientId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		}

	</script>
</body>
</html>